/**  
 * @Title: GetClientPacket.java
 * @Package com.iflytek.uoamp.agent.monitor.internet
 * @author qinanyuan
 * @date 2017年3月23日 下午3:26:44
 * @version V0.7.0  
 */
    
package com.iflytek.uoamp.agent.monitor.internet;


/**
 * @ClassName: GetClientPacket
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author qinanyuan
 * @date 2017年3月23日 下午3:26:44
 */

public class GetClientPacket {

	String ipAddr;// 本机ip地址数组

	private int upLoadIPPacketSize = 0;// 上传IP数据包总字节数

	private int downLoadIPPacketSize = 0;// 下载IP数据包总字节数

	public int getupLoadIPPacketSize() {
		return upLoadIPPacketSize;
	}

	public int getdownLoadIPPacketSize() {
		return downLoadIPPacketSize;
	}

	public GetClientPacket() {
		// 空实现
	}

	public GetClientPacket(String ipAddr) {
		this.ipAddr = ipAddr;
	}

	// 获得截取的数据包
//	public void receivePacket(Packet p) {
//		if (p instanceof IPPacket) {// 如果截取的是IP包
//			IPPacket ippacket = (IPPacket) p;
//			if (ippacket.src_ip.getHostAddress().equals(ipAddr.substring(1))) {// 如果IP包的源IP地址等于本机ip则此包为上传包
//				upLoadIPPacketSize = ippacket.len;
//				Map<String, Object> upload = InterNetSpeed.getInstance().getUpload();
//				if (upload.get(ippacket.dst_ip.getHostAddress()) != null) {
//					upload.put(ippacket.dst_ip.getHostAddress(), Integer.parseInt(upload.get(ippacket.dst_ip.getHostAddress()).toString()) + upLoadIPPacketSize);
//				} else {
//					upload.put(ippacket.dst_ip.getHostAddress(), upLoadIPPacketSize);
//				}
//				InterNetSpeed.getInstance().setUpload(upload);
//			} else if (ippacket.dst_ip.getHostAddress().equals(ipAddr.substring(1))) {// 如果IP包的目的IP地址等于本机ip则此包为下载包
//				downLoadIPPacketSize = ippacket.len;
//				Map<String, Object> download = InterNetSpeed.getInstance().getDownload();
//				if (download.get(ippacket.src_ip.getHostAddress()) != null) {
//					download.put(ippacket.src_ip.getHostAddress(), Integer.parseInt(download.get(ippacket.src_ip.getHostAddress()).toString())
//							+ downLoadIPPacketSize);
//				} else {
//					download.put(ippacket.src_ip.getHostAddress(), downLoadIPPacketSize);
//				}
//				InterNetSpeed.getInstance().setDownload(download);
//			}
//		}

//	}



}
